Skip to content

fix: address code review issues — config.R, duplicate code, misleading names - #1

Open
mugpeng wants to merge 2 commits into
GangLiLab:masterfrom
mugpeng:master
Open

fix: address code review issues — config.R, duplicate code, misleading names#1
mugpeng wants to merge 2 commits into
GangLiLab:masterfrom
mugpeng:master

Conversation

@mugpeng

@mugpeng mugpeng commented Aug 19, 2026

Copy link
Copy Markdown

Hi authors,

Thank you for sharing the COMPASS benchmark scripts. After carefully reviewing the code, I've put together a PR addressing the bugs and code quality issues identified in a recent code review. All changes are backward-compatible in logic — no scoring formulas or statistical methods were altered.

Bug #1 (P0): Missing config.R — Added config.R.example documenting every required variable. Scripts now print a clear message when config.R is absent, pointing to the example.

Bug #2 (P2): Misleading column name — Renamed winner_single_only_fractionwinner_no_both_fraction in 03_run_priority_audit.R to match the any(evidence_type=="both") logic.

Bug #3 (P2): Wrong method name — Renamed RankProduct_missing0RankGeometricMean_missing0. The formula sqrt(rank1 * rank2) is geometric mean, not rank product. Also removed redundant pmax(...,0).

Bug #4 (P1): Duplicated average_precision_grouped — Extracted to scripts/utils.R; 01 and 02 now source it from there.

Bug #5 (P1): Triplicated normalisation helpers — Extracted normalize_gene, normalize_tissue, read_gmt_genes, load_rda_list to scripts/utils.R.

Bug #7 (P1): Hardcoded paths in 02/03 — Both scripts now source("config.R") and source("scripts/utils.R"), using shared OUT_DIR, DIAG_OUT_DIR, AUDIT_OUT_DIR.

Bug #10 (P3): Missing .gitignore — Added, covering R artifacts and large regenerable outputs.

Not changed (design choices): Bug #6 (asymmetric penalties), Bug #8 (AUC implementations), Bug #9 (bootstrap stratification).

Files: config.R.example (new), scripts/utils.R (new), updated 00/01/02/03, .gitignore (new).

Note: 03_run_priority_audit.R reads 03_gene_level_scores_COMPASS_and_baselines.tsv which must be regenerated by 01 with the new RankGeometricMean_missing0 column name.

…g names

- Add config.R.example with all required parameters documented
- Add scripts/utils.R with shared utility functions (normalize_gene,
  normalize_tissue, read_gmt_genes, load_rda_list,
  average_precision_grouped)
- Remove duplicate utility functions from 01/02/03; source utils.R
- Rename RankProduct_missing0 -> RankGeometricMean_missing0 (Bug #3)
- Rename winner_single_only_fraction -> winner_no_both_fraction (Bug #2)
- 02/03 now source config.R instead of hardcoding paths/parameters
- Add .gitignore for R artifacts and large regenerable outputs
- Add clear error messages when config.R is missing, pointing to
  config.R.example

Addresses Bugs GangLiLab#1-#5, #7, #10 from the code review.
Remaining issues (#6, #8, #9) are design choices left to authors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant